Skip to content

docs: Documenter.jl setup, tutorials, and API fixes#30

Merged
shinaoka merged 5 commits intomainfrom
feat/documenter-setup
Apr 7, 2026
Merged

docs: Documenter.jl setup, tutorials, and API fixes#30
shinaoka merged 5 commits intomainfrom
feat/documenter-setup

Conversation

@shinaoka
Copy link
Copy Markdown
Member

@shinaoka shinaoka commented Apr 7, 2026

Summary

  • Set up Documenter.jl with GitHub Pages deployment
  • Add 1D quantics interpolation and 1D Fourier transform tutorials
  • Fix QuanticsTCI ccall signature mismatch (segfault/capacity overflow bug)
  • Add swap_site_indices! and rearrange_siteinds to TreeTN API

Changes

Documentation infrastructure

  • docs/Project.toml, docs/make.jl: Documenter.jl build with per-module API pages
  • docs/src/index.md: Overview + quick start
  • docs/src/modules.md: Module dependency graph and data flow
  • docs/src/api/: 7 API reference pages (Core, SimpleTT, TreeTN, QuanticsGrids, QuanticsTCI, QuanticsTransform, TreeTCI)
  • .github/workflows/docs.yml: CI builds Rust lib, generates docs, deploys to gh-pages

Tutorials (migrated from T4APlutoExamples)

  • docs/src/tutorials/quantics1d.md: Grid creation, QTCI, evaluation, integration, MPS conversion
  • docs/src/tutorials/fourier1d.md: QTT Fourier transform pipeline on 2^40-point grid

Bug fix

  • QuanticsTCI ccall mismatch: Rust C API (PR #393) expanded t4a_quanticscrossinterpolate_f64 from 7 to 13 params; Julia ccall was not updated, causing stack misalignment → segfault. Now synced. Returns (qtci, ranks, errors) tuple.

New API

  • swap_site_indices!(ttn, target): Swap site indices to target vertices via SVD
  • rearrange_siteinds(ttn, layout): High-level site rearrangement

AGENTS.md updates

  • Error handling policy (Julia-side validation, array contiguity, Rust error propagation)
  • Documentation requirements (docstring rules, Documenter.jl structure, module dependency graph)

Requires (tensor4all-rs)

Two C API functions were added to tensor4all-rs (separate PR needed):

  • t4a_linop_set_input_space / t4a_linop_set_output_space
  • t4a_treetn_swap_site_indices

Test plan

  • julia --project=docs docs/make.jl builds without errors
  • Documentation pages render correctly at GitHub Pages
  • CI passes (QTCI fix does not break existing tests)
  • GitHub Pages enabled (Settings > Pages > Branch: gh-pages)

🤖 Generated with Claude Code

shinaoka and others added 5 commits April 7, 2026 19:08
- AGENTS.md: add Error Handling and Documentation Requirements sections
- docs/make.jl: Documenter.jl build with per-module API pages
- docs/src/: index, module architecture, 7 API reference pages, tutorial stubs
- .github/workflows/docs.yml: CI builds Rust lib, generates docs, deploys to gh-pages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Rust C API (PR #393) expanded t4a_quanticscrossinterpolate_f64 and
t4a_quanticscrossinterpolate_discrete_f64 from 7/9 to 13/15 parameters,
adding options, initial_pivots, n_pivots, out_ranks, out_errors, and
out_n_iters. The Julia ccall bindings were not updated, causing stack
misalignment and a capacity overflow panic in parse_initial_pivots.

- C_API.jl: update both ccall bindings to match 13/15-parameter signatures
- QuanticsTCI.jl: allocate rank/error buffers, return (qtci, ranks, errors)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers grid creation, QTCI with both max_bonddim and tolerance modes,
evaluation, integration, bond dimension inspection, and MPS conversion.
Uses multi-scale oscillatory function f(x)=exp(-x)*cos(x/B) as main example.

Migrated from T4APlutoExamples/quantics1d.jl to Tensor4all.jl API.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pipeline: QuanticsTCI → MPS → fourier_operator → set_iospaces! → apply → evaluate.
Demonstrates DFT on 2^40-point grid with sum-of-exponentials test function.
Shows analytical verification via geometric series and high-frequency access.

Migrated from T4APlutoExamples/qft.jl Part A.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- C_API.jl: add t4a_treetn_swap_site_indices binding
- TreeTN.jl: add swap_site_indices!(ttn, target) and rearrange_siteinds
- Tensor4all.jl: export new functions

Note: adjacent swaps work; non-adjacent multi-site swaps may fail due to
a convergence limitation in the Rust swap algorithm (to be fixed upstream).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shinaoka shinaoka enabled auto-merge April 7, 2026 10:55
@shinaoka shinaoka merged commit a08082d into main Apr 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant